<script setup>

const emit = defineEmits(['close','save'])

const props = defineProps({
  currentDetail: {
    type: Object,
    required: true
  },
});
</script>

<template>

  <div class="modal is-active">
    <div class="modal-background"></div>
    <div style="width:600px;width:1100px;" class="modal-card">
      <header class="modal-card-head">
        <p class="modal-card-title">索引详情</p>
        <button aria-label="close" class="delete" @click="emit('close')"></button>
      </header>
      <section class="modal-card-body">
        <table class="table is-fullwidth">
          <caption class="m-2">索引信息</caption>
          <tr>
            <td class="has-background-link-light">索引名称</td>
            <td>{{currentDetail.name}}</td>
            <td  class="has-background-link-light">数据源</td>
            <td>{{currentDetail.conn}}</td>
            <td  class="has-background-link-light">数据库</td>
            <td>{{currentDetail.database}}</td>
            <td class="has-background-link-light">数据表</td>
            <td>{{currentDetail.table}}（{{currentDetail.key}}）</td>
          </tr>
          <tr>
            <td class="has-background-link-light">索引目录</td>
            <td>{{currentDetail.path}}</td>
            <td class="has-background-link-light">接收CDC</td>
            <td>{{currentDetail.cdc}}</td>
            <td class="has-background-link-light">重建计划</td>
            <td>{{currentDetail.cron}}</td>
            <td class="has-background-link-light">主键</td>
            <td>{{currentDetail.key}}</td>
          </tr>
          <tr>
            <td class="has-background-link-light">分词器</td>
            <td>{{currentDetail.analyzer}}</td>
            <td class="has-background-link-light">目录类型</td>
            <td>{{currentDetail.fsdType}}</td>
            <td class="has-background-link-light">索引类型</td>
            <td>{{currentDetail.type}}</td>
            <td class="has-background-link-light">索引字段</td>
            <td>{{currentDetail.fields}}</td>
          </tr>
        </table>
        <table class="table is-fullwidth">
          <caption class="m-2">字段信息</caption>
          <thead>
          <tr>
            <th>数据库字段</th>
            <th>类型</th>
            <th>存储</th>
            <th>排序</th>
            <th>分词</th>
            <th>分组</th>
            <th>字典</th>
            <th>排除</th>
          </tr>
          </thead>
          <tbody>
          <tr v-for="(item,itemIndex)  in currentDetail.fieldsConfig" v-if="currentDetail && currentDetail.fieldsConfig">
            <td>{{ item.fieldName }}</td>
            <td>{{ item.typeName }}</td>
            <td>{{ item.stored }}</td>
            <td>{{ item.sort }}</td>
            <td>{{ item.analyzerd }}</td>
            <td>{{ item.grouping }}</td>
            <td>{{ item.sets }}</td>
            <td v-if="item.exclude==true"><span class="tag is-danger">是</span></td>
            <td v-else>否</td>
          </tr>
          </tbody>
        </table>
      </section>
    </div>
  </div>
</template>

<style scoped>

</style>